<template>
  <div>
    <el-row :gutter="10">
      <el-col :xs="24" :sm="24" :md="16" :lg="14" :xl="12">
        <el-dialog :model-value="show" title="高级查询" :before-close="closeRight">
          <el-form :model="form" label-position="top">
            <el-form-item label="药名：" :label-width="formLabelWidth">
              <el-input v-model.trim="form.ym" autocomplete="on" />
            </el-form-item>
            <el-form-item label="功能主治/临床应用：" :label-width="formLabelWidth">
              <el-input v-model.trim="form.gnzz" autocomplete="on" />
            </el-form-item>
            <el-form-item label="归经：" :label-width="formLabelWidth">
              <el-input v-model.trim="form.gj" autocomplete="on" />
            </el-form-item>
            <el-form-item label="注意禁忌：" :label-width="formLabelWidth">
              <el-input v-model.trim="form.zyjj" autocomplete="on" />
            </el-form-item>
          </el-form>
          <template #footer>
            <span class="dialog-footer">
              <el-button @click="emit('toggleDialog', false)">关 闭</el-button>
              <el-button type="primary" @click="sbumitSearch()">搜 索</el-button>
            </span>
          </template>
        </el-dialog>
      </el-col>
    </el-row>
  </div>
</template>
<script setup>
// 引入依赖=====================================
import { onMounted, ref, reactive, watch, toRefs, watchEffect } from "vue";
// 数据声明=====================================
const formLabelWidth = '140px'
const dialogTableVisible = ref(false)
const props = defineProps({
  show: {
    type: Boolean,
    default: false
  }
})
const emit = defineEmits(['toggleDialog', 'expertSearch'])
const form = reactive({
  ym: '',
  gnzz: '',
  gj: '',
  zyjj: '',
})

// 生命周期=====================================


// 业务逻辑=====================================

// 高级搜索
function sbumitSearch() {
  console.log('submit！', form.ym + form.gnzz + form.gj + form.zyjj);
  if (form.ym + form.gnzz + form.gj + form.zyjj == '') {
    return
  }
  emit('toggleDialog', false)
  emit('expertSearch', form)

}
//右上角关闭 
function closeRight() {
  emit('toggleDialog', false)
}
</script>
<style lang="less" scoped>
.el-dialog {
  font-weight: bold;
}

.el-form-item {
  font-weight: bold;
}
</style>